$(function(){
	$('#tt').datagrid({
		url:'/user/upgrade/addJZList'
	});
	
});

function doSearch(){
	var mark = $('#markId').val();
	var name = $('#nameId').val();
	if (mark == '' && name == '') {
		$.messager.alert("提示", "搜索条件不能为空");
		return false;
	}
	
	$('#tt').datagrid({
		url:'/user/upgrade/addJZList',
		queryParams:{
			name : name,
			mark : mark
		}
	});
	$('#tt').datagrid('unselectAll');
}

function dataOnLoadSuccess(){
	$('#tt').datagrid('unselectAll');
}

/*function doJZByMark(){
	var mark = $('#markId').val();
	if (mark == '' && name == '') {
		$.messager.alert("提示", "mark不能为空");
		return false;
	}
	$.ajax({
		url:'/user/upgrade/calByMark',
		type:'post'	,
		data:'mark='+mark,
		success: function(data) {
			$.messager.alert("提示", "校准成功");
		} 
	})
}*/

function doAddJZByDate(){
	var start = $('#start').datebox('getValue');
	var end = $('#end').datebox('getValue');
	var mark = $('#markId').val();
	if (start == '' && start == '') {
		$.messager.alert("提示", "请输入起始时间");
		return false;
	}
	$("#jzByDate").removeAttr('onclick');
	$.ajax({
		url:'/user/upgrade/addJZByDate',
		type:'post'	,
		data:{startTime : start, endTime : end, mark : mark},
		success: function(data) {
			$.messager.alert("提示", "校准成功");
		},
		complete: function() {
			$("#jzByDate").attr("onclick","doAddJZByDate();");
		}
	})	
}
